package com.songlanyun.modules.goodsuserdiscount.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.common.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 商品会员折扣明细
 * 
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-13 09:54:23
 */
@Data
@TableName("yxt_product_goods_user_discount_detail")
public class GoodsUserDiscountDetail extends RootEntity<Long,GoodsUserDiscountDetail> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
	private Long id;
	/**
	 * 商品id
	 */
	@NotNull(message = "必须指定商品Id")
	private Long goodsId;
	/**
	 * 会员等级码
	 */
	@NotBlank(message = "会员等级码不能为空")
	@Length(min = 1, max = 50, message = "会员等级码长度在1-50个字")
	private String roleCode;
	/**
	 * 会员等级名
	 */
	@NotBlank(message = "会员等级名不能为空")
	@Length(min = 1, max = 20, message = "会员等级名长度在1-20个字")
	private String roleName;
	/**
	 * 折扣
	 */
	@DecimalMin(value = "0.1", message = "折扣最小是0.1")
	@DecimalMax(value = "10.0", message = "折扣最小是10.0")
	private BigDecimal discount;

	/**
	 * 等级值
	 */
	private Integer level;

	@Override
	public Long getIdentity() {
		return getId();
	}
}
